package com.gjy.test.other;

import org.apache.commons.codec.binary.Base64;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-05-08 17:59:28
 */
public class T11 {

    @Test
    public void test1() throws IOException {
        File file = new File("D:\\yurun\\OA文档\\功能开发\\农信测试流程\\1654789863200616450.docx");
        FileInputStream fis = new FileInputStream(file);
        byte[] bytes = new byte[(int) file.length()];
        fis.read(bytes);

        String s = Base64.encodeBase64String(bytes);

        System.out.println(s);

//        byte[] base64 = Base64.decodeBase64(s);
//        String s1 = new String(base64);
//
//        System.out.println(s1);
    }
}
